home *** CD-ROM | disk | FTP | other *** search
- //=============================================================================
- // Story.
- // See Story.txt
- //=============================================================================
- class Story extends Actor placeable;
-
- //#1 Declare an instance of the class
- // in class scope
-
- var private string ActionMessage;
- var private int Next;
- var private Array<string> Story;
-
-
- // Goes in MakeMessage
- public function string TellStory(){
- local string StoryLine;
- StoryLine = GetLineOfStory();
- return StoryLine;
- }
-
- // Goes PostBeginPlay
- public function MakeStory(){
- CreateStory();
- }
-
- private function CreateStory(){
- // Assign text values to elements
- Story[0]= "In a village";
- Story[1]= "Once there lived a holy man";
- Story[2]= "He was poor";
- Story[3]= "His house had a dirt floor";
- Story[4]= "His house had a stove";
- Story[5]= "This man had a dream";
- Story[6]= "Three times he had the dream";
- Story[7]= "And so he thought it from God";
- Story[8]= "Of going to a city";
- Story[9]= "And a palace in the city";
- Story[10]= "Where he, poor man";
- Story[11]= "Would find a treasure";
- Story[12]= "He went to the city";
- Story[13]= "It was far away";
- Story[14]= "And in the city he found the palace";
- Story[15]= "It was well guarded";
- Story[16]= "And a guard stopped him ";
- Story[17]= "\"What are you doing here?\" the guard demanded ";
- Story[18]= "\"I had a dream to come here, to this palace";
- Story[19]= "\"Do not be foolish, said the guard";
- Story[20]= "\"I once had a dream that a poor holy man would come here";
- Story[21]= "\"And I would follow him home, to a village far away";
- Story[22]= "\"And behind his stove would in his wretched home ";
- Story[23]= "\"A treasure would be buried ";
- Story[24]= "\"Go home, old one, and do not believe foolish dreams.\"";
- Story[25]= "So the holy man thanked the guard.";
- Story[26]= "After many days, he arrived home.";
- Story[27]= "Behind his stove he started digging.";
- Story[28]= "Soon he found the buried treasure.";
- }
-
- private function string GetLineOfStory(){
- local string TMessage;
- // Retrieve an element from the array
- if(Next < Story.Length){
- TMessage = Story[Next];
- Next++;
- }else{
- Next = 0;
- }
- return TMessage;
- }
-
-
-
-
-
-
-